<!DOCTYPE html>
<html>
<head>
  <meta charset="utf-8">
  <title>帖子列表</title>
  <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
  <meta name="keywords" content="前端社区">
  <meta name="description" content="技术交流社区网站">
  <link rel="stylesheet" href="/static/web/res/layui/css/layui.css">
  <link rel="stylesheet" href="/static/web/res/css/global.css">
</head>
<body>
@extends('Web.common.header')

<div class="fly-panel fly-column">
  <div class="layui-container">
    <ul class="layui-clear">
      <li class="layui-hide-xs {{$type_id>0?'':'layui-this'}}"><a href="/forumList">首页</a></li>
      @if($type)
        @foreach($type as $key => $value)
          <li class="{{$type_id==$value['id']?'layui-this':''}}"><a href="/forumList/{{$value['id']}}">{{$value['title']}}</a></li>
        @endforeach
      @endif
      <li class="layui-hide-xs layui-hide-sm layui-show-md-inline-block"><span class="fly-mid"></span></li>
      <!-- 用户登入后显示 -->
      @if(web_user_info())
        <li class="layui-hide-xs layui-hide-sm layui-show-md-inline-block"><a href="/userIndex">我发表的贴</a>
        </li>
        <li class="layui-hide-xs layui-hide-sm layui-show-md-inline-block"><a href="/userIndex#collection">我收藏的贴</a>
        </li>
      @endif
    </ul>

    <div class="fly-column-right layui-hide-xs">
      {{--<span class="fly-search"><i class="layui-icon"></i></span>--}}
      <a href="/forumCreate" class="layui-btn">发表新帖</a>
    </div>
  </div>
</div>

<div class="layui-container">
  <div class="layui-row layui-col-space15">
    <div class="layui-col-md8">
      <div class="fly-panel" style="margin-bottom: 0;">
        <div class="fly-panel-title fly-filter">
          <a href="{{$path}}/0" class="{{$tag==0?'layui-this':''}}">综合</a>
          <span class="fly-mid"></span>
          <a href="{{$path}}/2" class="{{$tag==2?'layui-this':''}}">一般</a>
          <span class="fly-mid"></span>
          <a href="{{$path}}/3" class="{{$tag==3?'layui-this':''}}">上品</a>
          <span class="fly-mid"></span>
          <a href="{{$path}}/4" class="{{$tag==4?'layui-this':''}}">精品</a>
          <span class="fly-filter-right layui-hide-xs">
            <a href="/{{$allPath}}?sort=newest" class="{{$sort=='newest'?'layui-this':''}}">按最新</a>
            <span class="fly-mid"></span>
            <a href="/{{$allPath}}?sort=host" class="{{$sort=='host'?'layui-this':''}}">按热议</a>
          </span>
        </div>

        @if($list['data'])
          <ul class="fly-list">
              @foreach($list['data'] as $item)
                  <li>
                      <a href="/userHome?id={{$item['get_user']['id']}}" class="fly-avatar">
                          <img src="{{$item['get_user']['head_img']['url']}}" alt="{{$item['get_user']['name']}}">
                      </a>
                      <h2>
                          <a class="layui-badge">{{$item['get_type']['title']}}</a>
                          <a href="/forumDetail/{{$item['id']}}">{{$item['title']}}</a>
                      </h2>
                      <div class="fly-list-info">
                          <a href="/userHome?id={{$item['get_user']['id']}}" link>
                              <cite>{{$item['get_user']['name']}}</cite>
                              @if($item['get_user']['rank'] > 0)
                                  <i class="iconfont icon-renzheng"></i>
                                  <i class="layui-badge fly-badge-vip">VIP{{$item['get_user']['rank']}}</i>
                              @endif
                          </a>
                          <span>{{friendly_date($item['created_at'])}}</span>
                          {{--<span class="fly-list-kiss layui-hide-xs" title="悬赏飞吻"><i class="iconfont icon-kiss"></i> 60</span>--}}
                          @if(!empty($list['user']) && $list['user']['id'] == $item['user_id'] && $item['status'] ==1)
                              <span class="layui-badge fly-badge-accept">审核中</span>
                          @endif
                          @if(!empty($list['user']) && $list['user']['id'] == $item['user_id'] && $item['status'] ==2)
                            <span class="layui-badge layui-bg-gray">被拒绝</span>
                          @endif
                          <span class="fly-list-nums">
                              <i class="iconfont icon-pinglun1" title="回答"></i> {{$item['get_comment_count']}}
                          </span>
                      </div>
                      <div class="fly-list-badge">
                          @if($item['is_top']==1)
                              <span class="layui-badge layui-bg-black">置顶</span>
                          @endif
                          {!! $item['tag'] !!}
                      </div>
                  </li>
              @endforeach
          </ul>
          @if($list['total'] > 15)
          <div style="text-align: center">
            <div id="page" data-count="{{$list['total']}}" data-curr="{{$list['current_page']}}"></div>
          </div>
          @endif
        @else
          <div class="fly-none">没有相关数据</div>
        @endif
      </div>
    </div>
    <div class="layui-col-md4">
      <dl class="fly-panel fly-list-one">
        <dt class="fly-panel-title">最近热议</dt>
        @foreach($host as $h)
          <dd>
            <a href="/forumDetail/{{$h['id']}}">{{$h['title']}}</a>
            <span><i class="iconfont icon-pinglun1"></i> {{$h['get_comment_count']}}</span>
          </dd>
        @endforeach
      </dl>

      <div class="fly-panel">
        <div class="fly-panel-title">
          这里可作为广告区域
        </div>
        <div class="fly-panel-main">
          <a href="" target="_blank" class="fly-zanzhu" style="background-color: #393D49;">虚席以待</a>
        </div>
      </div>

      {{--<div class="fly-panel fly-link">
        <h3 class="fly-panel-title">友情链接</h3>
        <dl class="fly-panel-main">
          <dd><a href="http://www.layui.com/" target="_blank">layui</a><dd>
          <dd><a href="http://layim.layui.com/" target="_blank">WebIM</a><dd>
          <dd><a href="http://layer.layui.com/" target="_blank">layer</a><dd>
          <dd><a href="http://www.layui.com/laydate/" target="_blank">layDate</a><dd>
          <dd><a href="mailto:xianxin@layui-inc.com?subject=%E7%94%B3%E8%AF%B7Fly%E7%A4%BE%E5%8C%BA%E5%8F%8B%E9%93%BE" class="fly-link">申请友链</a><dd>
        </dl>
      </div>--}}

    </div>
  </div>
</div>
@extends('Web.common.footer')
@section('script')
    <script>
        layui.use(['layer', 'jquery', 'form', 'laypage'], function () {
            $ = layui.jquery;
            var laypage = layui.laypage;
            var count = $('#page').data('count');
            var curr = $('#page').data('curr');
            //动态分页
            laypage.render({
                elem: 'page'
                , count: count
                , theme: '#2db5a3'
                , limit: 15
                , layout: ['page', 'next']
                , curr: curr
                , jump: function (obj, first) {
                    if (!first) {
                        window.location.href = "?page=" + obj.curr;//跳转链接
                    }
                }
            });

        });
    </script>
@endsection

</body>
</html>